Skip to content

Add simple asset autoloop#886

Merged
sputn1ck merged 11 commits intolightninglabs:masterfrom
sputn1ck:asset_autoloop_1
Mar 25, 2025
Merged

Add simple asset autoloop#886
sputn1ck merged 11 commits intolightninglabs:masterfrom
sputn1ck:asset_autoloop_1

Conversation

@sputn1ck
Copy link
Copy Markdown
Member

@sputn1ck sputn1ck commented Feb 17, 2025

This PR adds a simple asset autoloop mode by reusing the easy autoloop runloop.

Testing instructions:

In order to test you need a docker-regtest setup with an asset channel.

EDIT(hieblmi) Setup with an asset channel with following steps:

regtest init (should build litd)
regtest start
regtest assetmint
regtest openassetchan

Afterwards set up your loop with the extra flags:

  --tapd.activate \
  --tapd.host=localhost:8443 \
  --tapd.macaroonpath=$HOME/docker/mounts/regtest/eve/tapd.macaroon \
  --tapd.tlspath=$HOME/docker/mounts/regtest/eve/tls.cert \

You then need to activate your asset autoloop with

./loop-debug setparams --autoloop --easyautoloop --localbalancesat 500 --asset_id $ASSET_ID

Then you can run
./loop-debug forceautoloop this should dispatch a loop out

AI generated summary:

This pull request introduces significant changes to the assets/client.go and liquidity/liquidity.go files, adding new functionality for handling asset prices and improving the overall asset management. The most important changes include the addition of a new method to get asset prices, modifications to the client configuration to include an asset client, and updates to the liquidity manager to support easy autoloop functionality for assets.

Asset Management Enhancements:

  • assets/client.go: Added a new method GetAssetPrice to retrieve the price of an asset in satoshis using the RFQ process. Also, added a helper function getSatsFromAssetAmt to convert asset amounts to satoshis.
  • assets/client_test.go: Added tests for the new getSatsFromAssetAmt function to ensure correct conversion of asset amounts to satoshis.

Client Configuration Updates:

  • client.go: Updated the Client struct and related methods to use AssetClient instead of assetClient, ensuring consistency and proper initialization. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
  • config.go: Added AssetClient to the clientConfig struct to support asset-related operations.

Liquidity Manager Enhancements:

These changes collectively enhance the system's ability to manage and utilize assets more effectively, providing better support for asset-related operations and improving the overall functionality of the liquidity manager.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants